home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / cmds.fmt / tset.man < prev    next >
Encoding:
Text File  |  1989-02-23  |  13.7 KB  |  397 lines

  1.  
  2.  
  3.  
  4. TSET                      User Commands                      TSET
  5.  
  6.  
  7.  
  8. NNAAMMEE
  9.      tset, reset - terminal-dependent initialization
  10.  
  11. SSYYNNOOPPSSIISS
  12.      ttsseett [ options ] [ --mm [ident][test baudrate]:type ] ... [
  13.      type ]
  14.  
  15.      rreesseett [ options ] [ --mm [ident][test baudrate]:type ] ... [
  16.      type ]
  17.  
  18. DDEESSCCRRIIPPTTIIOONN
  19.      _T_s_e_t sets up your terminal when you first log in to a UNIX
  20.      system.  It does terminal dependent processing such as set-
  21.      ting erase and kill characters, setting or resetting delays,
  22.      sending any sequences needed to properly initialized the
  23.      terminal, and the like.  It first determines the _t_y_p_e of
  24.      terminal involved, and then does necessary initializations
  25.      and mode settings.  The type of terminal attached to each
  26.      UNIX port is specified in the /_e_t_c/_t_t_y_s(5) database.  Type
  27.      names for terminals may be found in the _t_e_r_m_c_a_p(5) database.
  28.      If a port is not wired permanently to a specific terminal
  29.      (not hardwired) it will be given an appropriate generic
  30.      identifier such as _d_i_a_l_u_p.
  31.  
  32.      In the case where no arguments are specified, _t_s_e_t simply
  33.      reads the terminal type out of the environment variable TERM
  34.      and re-initializes the terminal.  The rest of this manual
  35.      concerns itself with mode and environment initialization,
  36.      typically done once at login, and options used at initiali-
  37.      zation time to determine the terminal type and set up termi-
  38.      nal modes.
  39.  
  40.      When used in a startup script (._p_r_o_f_i_l_e for _s_h(1) users or
  41.      ._l_o_g_i_n for _c_s_h(1) users) it is desirable to give information
  42.      about the type of terminal you will usually use on ports
  43.      which are not hardwired.  These ports are identified in
  44.      /_e_t_c/_t_t_y_s as _d_i_a_l_u_p or _p_l_u_g_b_o_a_r_d or _a_r_p_a_n_e_t, etc.  To
  45.      specify what terminal type you usually use on these ports,
  46.      the --mm (map) option flag is followed by the appropriate port
  47.      type identifier, an optional baud rate specification, and
  48.      the terminal type.  (The effect is to ``map'' from some con-
  49.      ditions to a terminal type, that is, to tell _t_s_e_t ``If I'm
  50.      on this kind of port, guess that I'm on that kind of termi-
  51.      nal''.) If more than one mapping is specified, the first
  52.      applicable mapping prevails.  A missing port type identifier
  53.      matches all identifiers.  Any of the alternate generic names
  54.      given in _t_e_r_m_c_a_p may be used for the identifier.
  55.  
  56.      A _b_a_u_d_r_a_t_e is specified as with _s_t_t_y(1), and is compared
  57.      with the speed of the diagnostic output (which should be the
  58.      control terminal).  The baud rate _t_e_s_t may be any combina-
  59.      tion of: >>, @@, <<, and !!; @@ means ``at'' and !! inverts the
  60.  
  61.  
  62.  
  63. Sprite v1.0                May 5, 1986                          1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. TSET                      User Commands                      TSET
  71.  
  72.  
  73.  
  74.      sense of the test.  To avoid problems with metacharacters,
  75.      it is best to place the entire argument to --mm within ``'''
  76.      characters; users of _c_s_h(1) must also put a ``\'' before any
  77.      ``!'' used here.
  78.  
  79.      Thus
  80.  
  81.           tset -m 'dialup>300:adm3a' -m dialup:dw2 -m
  82.           'plugboard:?adm3a'
  83.  
  84.      causes the terminal type to be set to an _a_d_m_3_a if the port
  85.      in use is a dialup at a speed greater than 300 baud; to a
  86.      _d_w_2 if the port is (otherwise) a dialup (i.e. at 300 baud or
  87.      less).  (NNOOTTEE:: the examples given here appear to take up
  88.      more than one line, for text processing reasons.  When you
  89.      type in real _t_s_e_t commands, you must enter them entirely on
  90.      one line.) If the _t_y_p_e finally determined by _t_s_e_t begins
  91.      with a question mark, the user is asked if s/he really wants
  92.      that type.  A null response means to use that type; other-
  93.      wise, another type can be entered which will be used
  94.      instead.  Thus, in the above case, the user will be queried
  95.      on a plugboard port as to whether they are actually using an
  96.      _a_d_m_3_a.
  97.  
  98.      If no mapping applies and a final _t_y_p_e option, not preceded
  99.      by a --mm, is given on the command line then that type is
  100.      used; otherwise the type found in the /_e_t_c/_t_t_y_s database
  101.      will be taken to be the terminal type.  This should always
  102.      be the case for hardwired ports.
  103.  
  104.      It is usually desirable to return the terminal type, as
  105.      finally determined by _t_s_e_t, and information about the
  106.      terminal's capabilities to a shell's environment.  This can
  107.      be done using the -- option; using the Bourne shell, _s_h(1):
  108.  
  109.           export TERM; TERM=`tset - _o_p_t_i_o_n_s...`
  110.  
  111.      or using the C shell, _c_s_h(1):
  112.  
  113.           setenv TERM `tset - _o_p_t_i_o_n_s...`
  114.  
  115.      With _c_s_h it is preferable to use the following command in
  116.      your .login file to initialize the TERM and TERMCAP environ-
  117.      ment variables at the same time.
  118.  
  119.           eval `tset -s _o_p_t_i_o_n_s...`
  120.  
  121.      It is also convenient to make an alias in your .cshrc:
  122.  
  123.           alias tset 'eval `tset -s \!*`'
  124.  
  125.      This allows the command:
  126.  
  127.  
  128.  
  129. Sprite v1.0                May 5, 1986                          2
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. TSET                      User Commands                      TSET
  137.  
  138.  
  139.  
  140.           tset 2621
  141.  
  142.      to be invoked at any time to set the terminal and environ-
  143.      ment.  NNoottee ttoo BBoouurrnnee SShheellll uusseerrss:: It is nnoott possible to get
  144.      this aliasing effect with a shell script, because shell
  145.      scripts cannot set the environment of their parent.  (If a
  146.      process could set its parent's environment, none of this
  147.      nonsense would be necessary in the first place.)
  148.  
  149.      These commands cause _t_s_e_t to place the name of your terminal
  150.      in the variable TERM in the environment; see _e_n_v_i_r_o_n(7).
  151.  
  152.      Once the terminal type is known, _t_s_e_t engages in terminal
  153.      driver mode setting.  This normally involves sending an ini-
  154.      tialization sequence to the terminal, setting the single
  155.      character erase (and optionally the line-kill (full line
  156.      erase)) characters, and setting special character delays.
  157.      Tab and newline expansion are turned off during transmission
  158.      of the terminal initialization sequence.
  159.  
  160.      On terminals that can backspace but not overstrike (such as
  161.      a CRT), and when the erase character is the default erase
  162.      character (`#' on standard systems), the erase character is
  163.      changed to BACKSPACE (Control-H).
  164.  
  165.      The options are:
  166.  
  167.      --ee_c  set the erase character to be the named character _c on
  168.           all terminals, the default being the backspace charac-
  169.           ter on the terminal, usually ^H.  The character _c can
  170.           either be typed directly, or entered using the hat
  171.           notation used here.
  172.  
  173.      --kk_c  is similar to --ee but for the line kill character rather
  174.           than the erase character; _c defaults to ^X (for purely
  175.           historical reasons).  The kill characters is left alone
  176.           if --kk is not specified.  The hat notation can also be
  177.           used for this option.
  178.  
  179.      --ii_c  is similar to --ee but for the interrupt character rather
  180.           than the erase character; _c defaults to ^C.  The hat
  181.           notation can also be used for this option.
  182.  
  183.      --    The name of the terminal finally decided upon is output
  184.           on the standard output.  This is intended to be cap-
  185.           tured by the shell and placed in the environment vari-
  186.           able TERM.
  187.  
  188.      --ss   Print the sequence of _c_s_h commands to initialize the
  189.           environment variables TERM and TERMCAP based on the
  190.           name of the terminal finally decided upon.
  191.  
  192.  
  193.  
  194.  
  195. Sprite v1.0                May 5, 1986                          3
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. TSET                      User Commands                      TSET
  203.  
  204.  
  205.  
  206.      --nn   On systems with the Berkeley 4BSD tty driver, specifies
  207.           that the new tty driver modes should be initialized for
  208.           this terminal.  For a CRT, the CRTERASE and CRTKILL
  209.           modes are set only if the baud rate is 1200 or greater.
  210.           See tty(4) for more detail.
  211.  
  212.      --II   suppresses transmitting terminal initialization
  213.           strings.
  214.  
  215.      --QQ   suppresses printing the ``Erase set to'' and ``Kill set
  216.           to'' messages.
  217.  
  218.      If ttsseett is invoked as rreesseett, it will set cooked and echo
  219.      modes, turn off cbreak and raw modes, turn on newline trans-
  220.      lation, and restore special characters to a sensible state
  221.      before any terminal dependent processing is done.  Any spe-
  222.      cial character that is found to be NULL or ``-1'' is reset
  223.      to its default value.  All arguments to _t_s_e_t may be used
  224.      with reset.
  225.  
  226.      This is most useful after a program dies leaving a terminal
  227.      in a funny state. You may have to type ``<LF>reset<LF>'' to
  228.      get it to work since <CR> may not work in this state. Often
  229.      none of this will echo.
  230.  
  231. EEXXAAMMPPLLEESS
  232.      These examples all assume the Bourne shell and use the -
  233.      option.  If you use _c_s_h, use one of the variations described
  234.      above.  Note that a typical use of _t_s_e_t in a .profile or
  235.      .login will also use the --ee and --kk options, and often the --nn
  236.      or --QQ options as well.  These options have not been included
  237.      here to keep the examples small.  (NNOOTTEE:: some of the exam-
  238.      ples given here appear to take up more than one line, for
  239.      text processing reasons.  When you type in real _t_s_e_t com-
  240.      mands, you must enter them entirely on one line.)
  241.  
  242.      At the moment, you are on a 2621.  This is suitable for typ-
  243.      ing by hand but not for a .profile, unless you are _a_l_w_a_y_s on
  244.      a 2621.
  245.  
  246.           export TERM; TERM=`tset - 2621`
  247.  
  248.      You have an h19 at home which you dial up on, but your
  249.      office terminal is hardwired and known in /etc/ttys.
  250.  
  251.           export TERM; TERM=`tset - -m dialup:h19`
  252.  
  253.      You have a switch which connects everything to everything,
  254.      making it nearly impossible to key on what port you are com-
  255.      ing in on.  You use a vt100 in your office at 9600 baud, and
  256.      dial up to switch ports at 1200 baud from home on a 2621.
  257.      Sometimes you use someone elses terminal at work, so you
  258.  
  259.  
  260.  
  261. Sprite v1.0                May 5, 1986                          4
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. TSET                      User Commands                      TSET
  269.  
  270.  
  271.  
  272.      want it to ask you to make sure what terminal type you have
  273.      at high speeds, but at 1200 baud you are always on a 2621.
  274.      Note the placement of the question mark, and the quotes to
  275.      protect the greater than and question mark from interpreta-
  276.      tion by the shell.
  277.  
  278.           export TERM; TERM=`tset - -m 'switch>1200:?vt100' -m
  279.           'switch<=1200:2621'
  280.  
  281.      All of the above entries will fall back on the terminal type
  282.      specified in /_e_t_c/_t_t_y_s if none of the conditions hold.  The
  283.      following entry is appropriate if you always dial up, always
  284.      at the same baud rate, on many different kinds of terminals.
  285.      Your most common terminal is an adm3a.  It always asks you
  286.      what kind of terminal you are on, defaulting to adm3a.
  287.  
  288.           export TERM; TERM=`tset - ?adm3a`
  289.  
  290.      If the file /_e_t_c/_t_t_y_s is not properly installed and you want
  291.      to key entirely on the baud rate, the following can be used:
  292.  
  293.           export TERM; TERM=`tset - -m '>1200:vt100' 2621`
  294.  
  295.      Here is a fancy example to illustrate the power of _t_s_e_t and
  296.      to hopelessly confuse anyone who has made it this far.  You
  297.      dial up at 1200 baud or less on a concept100, sometimes over
  298.      switch ports and sometimes over regular dialups.  You use
  299.      various terminals at speeds higher than 1200 over switch
  300.      ports, most often the terminal in your office, which is a
  301.      vt100.  However, sometimes you log in from the university
  302.      you used to go to, over the ARPANET; in this case you are on
  303.      an ALTO emulating a dm2500.  You also often log in on vari-
  304.      ous hardwired ports, such as the console, all of which are
  305.      properly entered in /_e_t_c/_t_t_y_s.  You want your erase charac-
  306.      ter set to control H, your kill character set to control U,
  307.      and don't want _t_s_e_t to print the ``Erase set to Backspace,
  308.      Kill set to Control U'' message.
  309.  
  310.           export TERM; TERM=`tset -e -k^U -Q - -m
  311.           'switch<=1200:concept100' -m 'switch:?vt100' -m
  312.           dialup:concept100 -m arpanet:dm2500`
  313.  
  314. FFIILLEESS
  315.      /etc/ttys port name to terminal type mapping database
  316.      /etc/termcap   terminal capability database
  317.  
  318. SSEEEE AALLSSOO
  319.      csh(1), sh(1), stty(1), ttys(5), termcap(5), environ(7)
  320.  
  321. BBUUGGSS
  322.      The _t_s_e_t command is one of the first commands a user must
  323.      master when getting started on a UNIX system.
  324.  
  325.  
  326.  
  327. Sprite v1.0                May 5, 1986                          5
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. TSET                      User Commands                      TSET
  335.  
  336.  
  337.  
  338.      Unfortunately, it is one of the most complex, largely
  339.      because of the extra effort the user must go through to get
  340.      the environment of the login shell set.  Something needs to
  341.      be done to make all this simpler, either the _l_o_g_i_n(1) pro-
  342.      gram should do this stuff, or a default shell alias should
  343.      be made, or a way to set the environment of the parent
  344.      should exist.
  345.  
  346.      This program can't intuit personal choices for erase, inter-
  347.      rupt and line kill characters, so it leaves these set to the
  348.      local system standards.
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393. Sprite v1.0                May 5, 1986                          6
  394.  
  395.  
  396.  
  397.